c# linq select only unique values from list

44

c# linq select only unique values from list -

var uniq = allvalues.GroupBy(x => x.Id).Select(y=>y.First()).Distinct();

c# linq select only unique values from list -

var uniqueCategories =  repository.GetAllProducts()
                                  .Select(p=>p.Category)
                                  .Distinct();

Comments

Submit
0 Comments